package com.example.libraryapp.activity.personal;

import com.example.libraryapp.bean.User;
import com.example.libraryapp.bean.response.BaseResponse;
import com.example.libraryapp.network.base.BaseHttpHandler;
import com.example.libraryapp.network.base.BasePresenter;

/**
 * @author 伍凯铭
 * @since 2020/6/19
 */
public class PersonalPresenterIml extends BasePresenter<PersonalContract.View> implements PersonalContract.Presenter{

    @Override
    public void updateUser(User user) {
        super.doRequest(getRequestService().updateUser(user),new UpdateHandler());
    }

    class UpdateHandler extends BaseHttpHandler<BaseResponse<User>> {

        UpdateHandler() {
            super(mView);
        }

        @Override
        public void onSuccess(BaseResponse<User> response) {
            if(mView != null) {
                mView.showUpdate(response);
                mView.showContent();
            }
        }
    }
}
